package com.safety.hat.service.hat.adapter;

import com.safety.hat.service.hat.IHatSocketService;
import org.springframework.scheduling.annotation.Async;

import javax.websocket.Session;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author: lijun
 * @Date: 2020/5/25 上午11:47
 */
public interface IHatSocketUserAdapterService<T> extends IHatSocketService<T> {

    /**
     * 获取所有的 device, key：deviceId
     */
    ConcurrentHashMap<String, Session> getAllOnLineHatUser();

    /**
     * 删除信息
     *
     * @param deviceId 设备ID
     */
    void removeInfo(String deviceId);

    /**
     * 如果不存在,新增一个 session 用以处理断线重连情况
     *
     * @param deviceId 设备ID
     * @param session  session
     */
    void asyncCheckAndPutSession(String deviceId, Session session);

}
